import httpRequest from "~/config/requet";
// 资讯列表
export const GetInformationList = (params) => {
  return httpRequest.getServer("/admin-api/biz/user/realtimeinfo/page", params);
};
// 资讯详情
export const GetInformationDetails = (params) => {
  return httpRequest.getClient("/admin-api/biz/user/realtimeinfo/get", params);
};

// 自定义菜单列表
export const GetCustomizationList = (params) => {
  return httpRequest.getServer(
    "/admin-api/biz/user/customize-menu/page",
    params
  );
};
// 自定义菜单详情
export const GetCustomizeMenuDetails = (params) => {
  return httpRequest.getClient(
    "/admin-api/biz/user/customize-menu-content/get",
    params
  );
};
// 文件下载
export const GetDownloadTheFile = (configId) => {
  return httpRequest.getClient(`/admin-api/infra/file/${configId}/get`, {});
};

// 获取报名表单列表
export const GetListOfRegistrationForms = (id) => {
  return httpRequest.getClient(`/admin-api/system/user/custom-table/get`, {
    id,
  });
};
// 提交自定义表单
export const SubmitRealtimeinfoUserCustom = (data) => {
  return httpRequest.postClient(
    `/admin-api/biz/user/realtimeinfo-user-custom/submit`,
    data
  );
};

export const GetInfoFormByUserId = (realtimeinfoId, userId) => {
  return httpRequest.getClient(
    "/admin-api/biz/user/realtimeinfo-user-custom/get-by-realtimeinfo-user",
    { realtimeinfoId, userId }
  );
};

export const getInfoFormByFormId = (id) => {
  return httpRequest.getClient(
    "/admin-api/biz/user/realtimeinfo-user-custom/get",
    { id }
  );
};

// 获取资讯表单
export const GetRealtimeinfoUserCustomList = (query) => {
  return httpRequest.getClient(
    `/admin-api/biz/user/realtimeinfo-user-custom/page`,
    query
  );
};

// 课程列表
export const GetCourseList = (params) => {
  return httpRequest.getServer(
    "/admin-api/biz/course/pageOfOfficialWebsite",
    params
  );
};
// 课程详情
export const GetCourseDetail = (params) => {
  return httpRequest.getClient(
    "/admin-api/biz/course/getOfOfficialWebsite",
    params
  );
};
// 通过id获取老师信息
export const GetTeacherInfo = (params) => {
  return httpRequest.getClient(
    `/admin-api/biz/teacher-instructors/get`,
    params
  );
};

// 获取课时信息
export const GetCourseSchedule = (params) => {
  return httpRequest.getClient("/admin-api/biz/sale-config/get", params);
};

// 销售配置列表（套餐列表）
export const GetSaleConfigList = (params) => {
  return httpRequest.getClient("/admin-api/biz/sale-config/list", params);
};

// 合作链接列表
export const GetInviteList = (params) => {
  return httpRequest.getServer(
    "/admin-api/biz/user/collaboration-link/page",
    params
  );
};

// 官网菜单列表

export const GetWebSiteList = (params) => {
  return httpRequest.getServer("/admin-api/biz/user/menu/list", params);
};

// 首页轮播图
export const GetWebSiteHomeImage = (params) => {
  return httpRequest.getServer("/admin-api/biz/user/home-image/list", params);
};

// 官网logo

export const GetWebSiteLogo = (params) => {
  return httpRequest.getServer(
    "/admin-api/biz/user/outsourcer/merchant/get",
    params
  );
};

// 赛事信息列表
export const GetEventsList = (params) => {
  return httpRequest.getServer("", params);
};

// 最新活动列表
export const GetListOfEvents = (params) => {
  return httpRequest.getServer("", params);
};

// 社交媒体列表
export const GetSocialMediaList = (params) => {
  return httpRequest.getServer("/admin-api/biz/user/social-media/list", params);
};

// 获取公司概况，联系我们，隐私政策

export const GetCompanyInfoOfType = (params) => {
  return httpRequest.getClient(
    "/admin-api/biz/user/agreement/get?agreementType",
    params
  );
};

// 使用账号获取租户ID
export const GetTenantIdByUserName = (params) => {
  return httpRequest.getClient("/admin-api/system/auth/get-id-by-name", params);
};

// 获取邮箱验证码

export const GetCodeOfEmail = (params) => {
  return httpRequest.postClient("/admin-api/biz/email/send-email-code", params);
};

// 验证邮箱

export const CheckEmailCode = (params) => {
  return httpRequest.postClient(
    "/admin-api/biz/email/validate-email-code",
    params
  );
};
// emailRegistration
export const emailRegistration = (params) => {
  return httpRequest.postClient("/admin-api/system/auth/register", params);
};

// 官网登录
export const userLogin = (params) => {
  return httpRequest.postClient("/admin-api/system/auth/login", params);
};

// 获取用户权限
export const getUserInfoPermission = (params) => {
  return httpRequest.getClient(
    "/admin-api/system/auth/get-permission-info",
    params
  );
};

// 获取用户信息
export const getUserInfo = () => {
  return httpRequest.getClient("/admin-api/system/user/profile/get");
};

// 获取用户信息
export const updateUserInfo = (body) => {
  return httpRequest.putClient("/admin-api/system/user/profile/update", body);
};

// 重置密码
export const restPassword = (params) => {
  return httpRequest.putClient("/admin-api/biz/email/update-password", params);
};

// 获取学员列表
export const GetStudentList = (params) => {
  return httpRequest.getClient("/admin-api/biz/student/page", params);
};

// 添加学员
export const AddStudent = (params) => {
  return httpRequest.postClient("/admin-api/biz/student/create", params);
};

// 删除学员
export const RemoveStudent = (id) => {
  return httpRequest.deleteClient("/admin-api/biz/student/delete", { id });
};

// 更新学员
export const UpdateStudent = (data) => {
  return httpRequest.putClient("/admin-api/biz/student/update", data);
};

// 上传支付凭证
export const UploadCourseOrder = (formData) => {
  return httpRequest.postClient(
    "/admin-api/biz/course-order/upload ",
    formData
  );
};

// 课程价格计算
export const priceCalculation = (params) => {
  return httpRequest.getClient("/admin-api/biz/sale-config/get", params);
};

// 确认已付款   保存订单
export const SaveOrder = (params) => {
  return httpRequest.postClient("/admin-api/biz/course-order/create", params);
};

export const uploadFile = (file) => {
  const body = new FormData();
  body.append("file", file);
  return httpRequest.postClient(`/admin-api/infra/file/upload`, body);
};
